<html>
	<head>
		<title>..:: 7Sev3n Bot ::..</title>
		<script type="text/javascript" src="js/cc.marcio.js"></script>
		<script language="javascript">

			
			cc.marcio.functions.loopInInterval("cc.marcio.ajax.getAsync('Ajax.php?action=atualiza','exec')", 3000);
			
			function exec(object) {
				var jsonArr = cc.marcio.dom.toJSON(object).list;
				var text = "<table border=1><tr><th>Setor</th><th>Quadrante</th><th>Slot</th><th>Status</th></tr>";
				for( var i=0; i < jsonArr.length; i++  ) {
					var planeta = jsonArr[i];
					text += "<tr><td>"; 
					text += planeta.setor;
					text += "</td><td>";
					text += planeta.quadrante;
					text += "</td><td>";
					text += planeta.slot;
					text += "</td><td>";
					text += planeta.usuario + "</td></tr>"; 
				}
				text += "</table>";
				cc.marcio.dom._html('result', text);
			}			

			function take() {
				var slot = cc.marcio.dom.value('slot');
				cc.marcio.ajax.postAsync('Ajax.php?action=take&slot='+slot, null);
			}

			function drop() {
				var slot = cc.marcio.dom.value('slot');
				cc.marcio.ajax.postAsync('Ajax.php?action=drop&slot='+slot, null);
			}
			
		</script>
	</head>
	<body>
		Escolha o planeta
		<input type="text" id="setor" size="3">:
		<input type="text" id="quadrante" size="3">:
		<input type="text" id="slot" size="3">
		<input type="button" value="take" onclick="take();">
		<input type="button" value="drop" onclick="drop();">
		<hr>
		<div id="result"></div>
	</body>
</html>